from src.bean.config_column_enum import ConfigColumnEnum
from src.bean.x_typing import PRE_HANDLE_TYPE
from src.model.common.train import common_train
from src.model.v1.v1_train import get_df_by_path
from src.model.v2.v2_pre_handle import v2_file_pre_handle
from src.util.common_util import printx, is_int, while_input
from src.util.config_manager import ConfigManager
from src.util.file_selector_util import select_multi_file


def v2_first_train_entrance(config: ConfigManager) -> None:
    model_id = config.get_new_id()
    file_path_list = select_multi_file(config.get_config(ConfigColumnEnum.use_terminal.value))
    if len(file_path_list) == 0:
        printx("请重新选择文件")
        return
    df, files = get_df_by_path(file_path_list)
    df, cluster, df2 = v2_file_pre_handle(df, model_id=model_id, handle_type=PRE_HANDLE_TYPE.train)
    printx("1:CatBoostClassifier|2:XGBClassifier")
    num = int(while_input("请选择模型:", is_int))
    if num == 1:
        common_train(config, files, model_id, df, cluster)
    if num == 2:
        pass
        # common_train_xgboost(config, files, model_id, df, cluster)
